local skynet = require "skynet"
local msghelper = require "authsvrhelper"
local base = require "base"
local serverbase = require "serverbase"
require "skynet.manager"

local params = ...

local Authsvrd = serverbase:new({
		max_uid = 0,
	})

function Authsvrd:tostring()
	return "Authsvrd"
end

local function Authsvrd_to_sring()
	return Authsvrd:tostring()
end

function  Authsvrd:init()
	msghelper:init(Authsvrd)
	self.eventmng.init(Authsvrd)
	self.eventmng.add_eventbyname("cmd", "authsvrcmd")
	self.eventmng.add_eventbyname("socket", "authsvrsocket")
	self.eventmng.add_eventbyname("RegLoginReq", "authsvrreglogin")
	self.eventmng.add_eventbyname("RegisterReq", "authsvrregister")
	self.eventmng.add_eventbyname("GetAuthAppidAndSecrectRes", "authsvrgetappidsecrect")
	self.eventmng.add_eventbyname("notice", "authsvrnotice")
	Authsvrd.__tostring = Authsvrd_to_sring
end

skynet.start(function()
	if params == nil then
		Authsvrd:start()
	else		
		Authsvrd:start(table.unpack(base.strsplit(params, ",")))
	end	
end)
